package ctrlayer;



import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The test class PersonCtrTest.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */
public class PersonCtrTest
{
    private ctrlayer.PersonCtr personCtr1;
    private static int counterP=1;
    /**
     * Default constructor for test class PersonCtrTest
     */
    public PersonCtrTest()
    {
        personCtr1 = new ctrlayer.PersonCtr();
    }

    /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
    @Before
    public void setUp()
    {
    }

    /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
    @After
    public void tearDown()
    {
    }

    @Test
    public void createLeder()
    {
        assertEquals(true, personCtr1.createLeder("Hans Hansen", "Her", "9000", "Aalborg", "1", "hej@hej.dk"));
        counterP++;
    }

    

    @Test
    public void updateAnsat()
    {
        personCtr1.createLeder("Hans Hansen", "Her", "9000", "Aalborg", "2", "hej@hej.dk");
        assertEquals(true, personCtr1.updateAnsat(counterP, Integer.MAX_VALUE, "Hans Hansen", "Her", "8000", "Aarhus", "3", "hej@hej.dk", "hej"));
        counterP++;
    }

    @Test
    public void deleteAnsat()
    {
        personCtr1.createLeder("Peter", "der", "55", "jeo", "4", "jeo");
        assertEquals(true, personCtr1.deleteAnsat(counterP));
        counterP++;
    }

    @Test
    public void kontrolLogin()
    {
        assertEquals(true, personCtr1.kontrolLogin("admin", "admin"));
    }

    @Test
    public void sletAnsatDerIkkeErDer()
    {
        assertEquals(false, personCtr1.deleteAnsat(Integer.MAX_VALUE));
    }
}






